{{extend 'layout.html'}}
{{
import os
def app_upload_form(sender=request.function):
    form=FORM("upload application: ",INPUT(_type="file",_name="file"),
              " or provide application url: ", INPUT(_type="text",_name="appurl",requires=IS_URL()),
              " and rename it: ", INPUT(_type="text",_name="filename",requires=IS_NOT_EMPTY),
              INPUT(_type="submit",_value="submit"))
    return form
def app_create_form(sender=request.function):
    form=FORM("create new application: ",
              INPUT(_type="text",_name="filename",requires=IS_NOT_EMPTY),
              INPUT(_type="submit",_value="submit"))
    return form
}}

<h1>Installed applications</h1>
<div style="text-align:right;">
web2py {{=myversion}}<br />
{{if session.check_version:}}
<div id="check_version">
Checking for upgrades...
</div>
<script>ajax('{{=URL(r=request,f='check_version')}}',[],'check_version');</script>{{session.check_version=False}}
{{else:}}
<div id="check_version">
{{=A(T('click to check for upgrades'),_href="javascript:ajax('"+URL(r=request,f='check_version')+"',[],'check_version')")}}
</div>
{{pass}}
</div>

{{for a in apps:}} {{if a==request.application:}}
<h2><a href="">{{=a}}</a></h2> [ 
{{else:}}
<h2><a href="/{{=a}}/default/index">{{=a}}</a></h2> [
<a href="{{=URL(r=request,f='uninstall',args=a)}}">uninstall</a> |
<a href="{{=URL(r=request,f='about',args=a)}}">about</a> |
<a href="{{=URL(r=request,f='design',args=a)}}">design</a> |
{{pass}}
<a href="{{=URL(r=request,f='errors',args=a)}}">errors</a> |
<a href="{{=URL(r=request,f='cleanup',args=a)}}">cleanup</a> |
<a href="{{=URL(r=request,f='pack',args=a)}}">pack all</a>
{{if not os.path.exists('applications/%s/compiled' % a):}}
| <a href="{{=URL(r=request,f='compile_app',args=a)}}">compile</a>
{{else:}}
| <a href="{{=URL(r=request,f='pack_compiled',args=a)}}">pack compiled</a> 
| <a href="{{=URL(r=request,f='remove_compiled_app',args=a)}}">remove compiled</a> 
{{pass}}
] <br/>
{{pass}}
<br/>
<lu>
<li>{{=app_create_form()}}</li>
<li>{{=app_upload_form()}}</li>
</lu>